package com.wt.admin.service;

import com.wt.admin.service.image.ImageProxyService;
import com.wt.admin.service.language.LanguageProxyService;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.Executor;

@Service
public class InitService implements ApplicationListener<ApplicationReadyEvent> {

    @Resource
    private LanguageProxyService languageProxyService;
    @Resource
    private ImageProxyService imageProxyService;
    @Resource
    private Executor publicThread;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        publicThread.execute(() -> languageProxyService.init());
        publicThread.execute(() ->imageProxyService.init());
    }
}
